/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FondoKradac.java
 *
 * Created on 12/05/2011, 04:56:36 PM
 */
package marquesina.fondo;

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.ImageIcon;

/**
 *
 * @author kradac
 */
public class FondoKradac extends javax.swing.JPanel {

    private int x;
    private int y;

    /** Creates new form FondoKradac */
    public FondoKradac(int x, int y, int ancho, int alto) {
        initComponents();
        this.setBackground(Color.red);
        this.x = x;
        this.y = y;
        this.setBounds(0, 0, ancho, alto);
    }

    @Override
    public void paintComponent(Graphics g) {
        ImageIcon fondo = new ImageIcon(getClass().getResource("/iconos/cacpeZ.png"));
        g.drawImage(fondo.getImage(), x, y, 180, 100, null);
        setOpaque(false);
        super.paintComponent(g);
    }

    public void setNuevoLugarIcono(int x, int y, int w, int h) {
        this.x = x;
        this.y = y;
        this.setBounds(0, 0, w, h);
        repaint();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 186, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 53, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
